<template>
  <transition name="fade">
    <div class="header-detail">
      <div class="detail-wrapper">
        <div class="detail-main">
          <h1 class="name">{{ name }}</h1>

          <div class="star-wrapper">
            <!-- 星星 -->
          </div>
          <div class="title">
            <div class="line"></div>
            <div class="text">优惠信息</div>
            <div class="line"></div>
          </div>

          <ul class="supports">
            <li
              class="supports-item"
              v-for="(item, index) in supports"
              :key="index"
            >
              <Support-ico :type="item.type" :size="2"></Support-ico>
              <span class="text">{{ item.description }}</span>
            </li>
          </ul>

          <div class="title">
            <div class="line"></div>
            <div class="text">商家公告</div>
            <div class="line"></div>
          </div>

          <div class="bulletin">
            <p class="content">{{ bulletin }}</p>
          </div>
        </div>
      </div>

      <div class="detail-close" @click.stop="hideDetail">
        <i class="icon-close"></i>
      </div>
    </div>
  </transition>
</template>

<script>
import Support from "@/components/support-ico/support-ico";

export default {
  components: {
    "Support-ico": Support,
  },
  props: {
    supports: {
      type: Array,
    },
    bulletin: {
      type: String,
    },
    name: {
      type: String,
    },
  },
  methods: {
    hideDetail() {
      // 控制页面消失，则需要传数据给父组件
      this.$emit("hide",false); //hide为抛出的事件名称，false为事件参数
    },
  },
};
</script>

<style lang="less">
.header-detail {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  overflow: hidden;
  background: rgba(7, 17, 27, 0.8);
  color: #fff;
  opacity: 1;
  backdrop-filter: blur(10px);
  .detail-wrapper {
    display: inline-block;
    width: 100%;
    height: 100%;
    min-width: 100%;
    .detail-main {
      margin-top: 64px;
      padding-bottom: 64px;
      .name {
        text-align: center;
        font-size: 16px;
        line-height: 16px;
        font-weight: bold;
      }
      .star-wrapper {
        margin-top: 8px;
        padding: 0 auto;
      }
      .title {
        display: flex;
        width: 80%;
        margin: 28px auto 24px auto;
        .line {
          flex: 1;
          border-bottom: 1px solid rgba(255, 255, 255, 0.2);
          transform: translateY(-50%);
        }
        .text {
          padding: 0 12px;
          font-weight: 700;
          font-size: 14px;
        }
      }
      .supports {
        width: 80%;
        margin: 0 auto;
        .supports-item {
          display: flex;
          align-items: center;
          padding: 0 12px;
          margin-bottom: 12px;
        }
        .supports-item:last-child {
          margin-bottom: 0;
        }
        .text {
          line-height: 16px;
          font-size: 14px;
          margin-left: 6px;
        }
      }
      .bulletin {
        width: 80%;
        margin: 0 auto;
        .content {
          padding: 0 12px;
          line-height: 24px;
          font-size: 14px;
        }
      }
    }
  }
  .detail-close {
    position: relative;
    width: 30px;
    height: 30px;
    margin: -64px auto 0 auto;
    font-size: 30px;
  }
}
.fade-enter,
.fade-leave-to {
  opacity: 0;
  background: rgba(7, 17, 27, 1);
}
.fade-enter-active,
.fade-leave-active {
  transition: all 0.5s;
}
</style>